Skip to content

W-20975340, W-21013345: SPM at checkout#3603

Merged
rasbhat merged 6 commits intot/team404/sfp-on-pwafrom
rvishwanathbhat/display-spms-at-checkout
Jan 28, 2026
Merged

W-20975340, W-21013345: SPM at checkout#3603
rasbhat merged 6 commits intot/team404/sfp-on-pwafrom
rvishwanathbhat/display-spms-at-checkout

Conversation

@rasbhat
Copy link

@rasbhat rasbhat commented Jan 23, 2026

Display Saved Payment Methods at checkout
Includes refactoring for the work item W-21013345 as well.

Description

  1. A registered User is able to view SPMs at checkout.
  2. A registered user is able to use SPMs to checkout and place order.

Currently supported SPMs are Credit cards and SEPA debit

Screenshot 2026-01-23 at 7 27 39 AM

Types of Changes

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Documentation update
  • Breaking change (could cause existing functionality to not work as expected)
  • Other changes (non-breaking changes that does not fit any of the above)

Breaking changes include:

  • Removing a public function or component or prop
  • Adding a required argument to a function
  • Changing the data type of a function parameter or return value
  • Adding a new peer dependency to package.json

Changes

  • (change1)

How to Test-Drive This PR

  • (step1)

Checklists

General

  • Changes are covered by test cases
  • CHANGELOG.md updated with a short description of changes (not required for documentation updates)

Accessibility Compliance

You must check off all items in one of the follow two lists:

  • There are no changes to UI

or...

Localization

  • Changes include a UI text update in the Retail React App (which requires translation)

@rasbhat rasbhat requested a review from a team as a code owner January 23, 2026 16:39
@cc-prodsec
Copy link
Collaborator

cc-prodsec commented Jan 23, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@rasbhat rasbhat requested a review from sf-mkosak January 23, 2026 16:40
@rasbhat
Copy link
Author

rasbhat commented Jan 23, 2026

Ran linter on the files. Will be adding tests for all the changes.

* @param {Array<string>} [expand] - Optional array of fields to expand in the customer query
*/
export const useCurrentCustomer = () => {
export const useCurrentCustomer = (expand = undefined) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

= undefined is redundant

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed


// Get the mocked useCustomer from commerce-sdk-react
// eslint-disable-next-line @typescript-eslint/no-var-requires
const mockUseCustomer = require('@salesforce/commerce-sdk-react').useCustomer

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is using require like this an established pattern in PWA?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a few test modules (shipping-address.test.js, use-add-to-cart-modal.test.js) in PWA that use it.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels suspect having to disable lint rule here. It'd be good to at least try to find another solution here in case this doesn't jive well with the PWA reviewers when we merge to develop. Otherwise PR is looking good and shaping up!

@sf-mkosak sf-mkosak self-requested a review January 28, 2026 17:14
Copy link

@sf-mkosak sf-mkosak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM. I would challenge you to try to remove the lint disabling in the test.

@rasbhat
Copy link
Author

rasbhat commented Jan 28, 2026

Overall LGTM. I would challenge you to try to remove the lint disabling in the test.

The lint disable is in place throughout the codebase wherever the require has been used. If not disabled, it throws a lint error:

/Users/rvishwanathbhat/dev/git-repos/pwa-kit/packages/template-retail-react-app/app/pages/checkout/partials/sf-payments-sheet.test.js
  1016:51  error  Require statement not part of import statement  @typescript-eslint/no-var-requires
  1157:17  error  Require statement not part of import statement  @typescript-eslint/no-var-requires

@rasbhat rasbhat changed the title W-20975340: SPM at checkout W-20975340, W-21013345: SPM at checkout Jan 28, 2026
@rasbhat rasbhat merged commit c9c028e into t/team404/sfp-on-pwa Jan 28, 2026
8 of 16 checks passed
@rasbhat rasbhat deleted the rvishwanathbhat/display-spms-at-checkout branch January 28, 2026 17:24
@sf-mkosak
Copy link

Overall LGTM. I would challenge you to try to remove the lint disabling in the test.

The lint disable is in place throughout the codebase wherever the require has been used. If not disabled, it throws a lint error:

/Users/rvishwanathbhat/dev/git-repos/pwa-kit/packages/template-retail-react-app/app/pages/checkout/partials/sf-payments-sheet.test.js
  1016:51  error  Require statement not part of import statement  @typescript-eslint/no-var-requires
  1157:17  error  Require statement not part of import statement  @typescript-eslint/no-var-requires

What I mean is change the implementation such that you don't use require and therefore don't need to override lint rules.

@rasbhat
Copy link
Author

rasbhat commented Jan 28, 2026

Overall LGTM. I would challenge you to try to remove the lint disabling in the test.

The lint disable is in place throughout the codebase wherever the require has been used. If not disabled, it throws a lint error:

/Users/rvishwanathbhat/dev/git-repos/pwa-kit/packages/template-retail-react-app/app/pages/checkout/partials/sf-payments-sheet.test.js
  1016:51  error  Require statement not part of import statement  @typescript-eslint/no-var-requires
  1157:17  error  Require statement not part of import statement  @typescript-eslint/no-var-requires

What I mean is change the implementation such that you don't use require and therefore don't need to override lint rules.

Ah, got it, let me try that. Will update my upcoming PR with it.

rasbhat added a commit that referenced this pull request Mar 5, 2026
…/display-spms-at-checkout

W-20975340, W-21013345: SPM at checkout
rasbhat added a commit that referenced this pull request Mar 5, 2026
…/display-spms-at-checkout

W-20975340, W-21013345: SPM at checkout
rasbhat added a commit that referenced this pull request Mar 5, 2026
…/display-spms-at-checkout

W-20975340, W-21013345: SPM at checkout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants